package com.pri.chat.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.netease.nim.uikit.common.util.string.StringUtil;
import com.netease.nim.uikit.net.entity.TiXianNote;
import com.pri.chat.R;

import java.util.List;

import androidx.annotation.Nullable;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/23
 */
public class TiXianNoteListAdapter extends BaseQuickAdapter<TiXianNote, BaseViewHolder> {
    public TiXianNoteListAdapter(int layoutResId, @Nullable List<TiXianNote> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TiXianNote item) {
        helper.setText(R.id.tv_lsh, item.getSerialNo());
        helper.setText(R.id.tv_status, "0".equals(item.getStatus())?"待审核":("1".equals(item.getStatus())?"通过":"不通过"));
        //类型  0--提现红包；1--愿望基金；2--收益；3--超级会员
        String lxLabel = "";
        if("0".equals(item.getTxType())){
            lxLabel += "新人红包提现";
        }else if("1".equals(item.getTxType())){
            lxLabel += "愿望金提现";
        }else if("2".equals(item.getTxType())){
            lxLabel += "收益金币提现";
        }else if("3".equals(item.getTxType())){
            lxLabel += "超级会员收益提现";
        }
        if("0".equals(item.getType())){
            lxLabel += "到支付宝";
        }else{
            lxLabel += "到微信";
        }
        TextView remark = helper.getView(R.id.remark);
        if("2".equals(item.getStatus())){
            remark.setText("失败原因："+item.getErrorInfo());
            remark.setVisibility(View.VISIBLE);
        }else{
            remark.setVisibility(View.GONE);
        }
        helper.setText(R.id.tv_type, lxLabel);
        helper.setText(R.id.tv_addDate, "申请时间："+item.getTxsqTime());
        helper.setText(R.id.tv_handleTime, "处理时间："+item.getHandleTime());
        helper.setText(R.id.tv_money,"￥"+item.getMoney());
        helper.setVisible(R.id.tv_handleTime, !StringUtil.isEmpty(item.getHandleTime()));

    }
}
